package com.hmall.order.task;

import com.hmall.order.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @Description:
 * @author: 小雷
 * @createTime: 2024-07-10 13:03:18
 */
@Component
public class OrderScheduled {

    @Autowired
    private OrderMapper orderMapper;

    /**
     * 定时任务，清理超时订单
     */
    @Scheduled(cron = "0 * * * * ?") //每分钟执行一次
    public void cancelTimeOutOrder() {
        //修改订单状态
        orderMapper.cancelTimeOutOrder();
    }
}
